Developer Documentation
PATH  Mac OS X Documentation > Developer Tools > Mac OS X Assembler Guide


Previous | Contents | Next

Operation Code Field

The operation code field of an assembly language statement identifies the statement as a machine instruction, an assembler directive, or a macro defined by the programmer:

One or more spaces or tabs must separate the operation code field from the following operand field in a statement. Spaces or tabs are optional between the label and operation code fields, but they help to improve the readability of the program.

Architecture- and Processor-Specific Caveats

M68000 (including MC68882)

For instance, a movb instruction moves a byte of data, but a movw instruction moves a 16-bit word of data. In general, the default size for data manipulation instructions on the 68030 and 68040 processors is 16-bit word.

Intel i386 Architecture

movw %bx,%cx
mov %bx,%cx
movw %ebx,%ecx

More than one prefix may be specified for some operation codes. For example:

lock/fs/xchgl %ebx,4(%ebp)

Segment register overrides and the 16-bit data specifications are usually given as part of the operation code itself or of its operands. For example, the following two lines of assembly generate the same instructions:

movw %bx,%fs:4(%ebp)
data16/fs/movl %bx,4(%ebp)

Not all prefixes are allowed with all instructions. The assembler does check that the repeat prefixes for strings instructions are used correctly, but doesn't otherwise check for correct usage.


Mac OS X Assembler Guide: ASM Layout

Previous | Contents | Next